Starts a particle system running at (x, y) - a torch, a smoking wreck, a waterfall - and keeps it running for as long as the instance that started it exists. It belongs to that instance: destroy the instance, leave the room or restart it, and the system stops by itself. There is no handle to keep and nothing to forget.
Works differently on Game Boy - The Game Boy draws 10 sprites on one line, so a room has 10 particles alive at a time, and they are drawn solid, without turning or changing size.
Works differently on Game Boy Color - The Game Boy Color draws 10 sprites on one line, so a room has 10 particles alive at a time, and they are drawn solid, without turning or changing size.
On other consoles this differs: see Side by side and How the consoles differ.
effect_start(sys, x, y)| Name | Type |
|---|---|
sys | effect |
x | real |
y | real |
Nothing.
Starts the effect sys running at (x, y) - a torch's flicker, a waterfall's mist, a wreck that keeps smoking - and keeps it running for as long as the instance that started it exists. Unlike effect_burst, which fires once and is done, a system started this way keeps making new particles every few frames (and keeps costing its share of the shared particle and matrix budgets) until it is stopped.
x and y are a place in the room, counted from the room's top-left corner, the same way an instance's own x and y are counted.
There is one exception, an effect made camera-space in the Particles tab ("cameraSpace": true in its effects/<name>.json). That is the kind you use for rain or snow, which follows the screen instead of sitting in the room. For a camera-space effect, x and y count from where the view begins, which is the top-left pixel of the screen: (0, 0) is the screen's top-left corner, whatever part of the room the camera is looking at. (In an older project that still counts from the middle, the same numbers counted from the middle of the view.) A cutscene's effect step set to the camera's space counts the same way.
The running system belongs to the instance that called effect_start. The moment that instance is gone, the system is gone too, and its slot is free for something else:
instance_destroy, or by anything else that removes it);You do not write a Destroy event to clean up, and there is no handle to store. A persistent instance is not cleared by a room change, so its system keeps running into the next room, and ends when that instance does.
This matters because the whole game can only run 6 systems at once. If a system could be lost with no way to turn it off, a game that started a few every time you entered a room would slowly use up all six, and nothing would ever come back. Because every system has an owner, that can never happen.
An instance runs one copy of each effect. If you call effect_start again for an effect this instance is already running, it does not start a second one - it moves the one that is running to the new (x, y) and leaves its timing alone. That is how you make an effect follow something that moves: call it again every Step.
// Step event - a flame that follows the instance
effect_start(fx_doc_spark, x, y - 8);It also means calling it every frame is safe: it never uses more than one slot.
What you give up: one instance cannot run two copies of the same effect at once. If an instance needs two flames, give them two effects, or make them two instances.
If all 6 slots belong to things that are still alive, the new system is not started. Nothing breaks and there is no error; the debug log says so once. Put one of the others out first with effect_stop (or destroy the instance that owns it), and the slot is free.
A script runs as the object that called it, so a system started inside a script belongs to that object, exactly as if you had written the line in the object's own event. A room's creation code has no object, so the room owns the system there, and it ends when the room changes or restarts. To make the room the owner on purpose from an instance - a bonfire that should keep burning after the match that lit it is destroyed - use effect_start_room.
effect_start(fx_doc_spark, x, y);Starts a continuously-running spark effect at this instance's own position. Put it in Create and nothing else is needed: it runs for as long as this instance is alive.
A running system costs its own slot out of a small pool of concurrently-running effects (6 for the whole game), on top of the particle and matrix budgets effect_burst already shares with everything else - see Budgets. Only one Additive/Alpha blend can be in effect screen-wide at a time; if two running systems both want one, the one started first keeps it - see Particles and lighting for the full story.
When all six places are taken, the next effect_start is turned away. A development build stops there and tells you what holds the places: the room's effects and the effects your objects started, each with the spot it was started at, and where the refused one wanted to start. A --release build keeps playing and draws nothing for the refused effect. Either way the game counts the refusals (the debug overlay's FX REFUSED row shows the number). To make room, stop one first with effect_stop, or use effect_burst for an effect that only needs a puff now and then: a burst keeps no place at all.
The system is owned by the instance that called this, and the engine lets go of it - and gives its slot back - the moment that instance is gone. (A persistent instance keeps its systems across room changes, and they end when it does.) Only 6 systems can run at once in the whole game, so this matters. Asking again for the same effect from the same instance does not start a second one: it moves the running one to the new (x, y) and leaves its timing alone, so call it every Step to make an effect follow something. One instance can run one copy of each effect; for two flames, use two effects or two instances. If all 6 slots belong to things that are still alive, the start simply does not happen - nothing breaks, and the debug log says so once. In a script the system belongs to the instance that called the script, as if the call were typed into its own event. In a room’s own creation code there is no “me”, so the room owns the system and it ends when the room changes. Use effect_start_room to make the room the owner on purpose. Every particle is a real hardware sprite, so a burst spends from the same 128-sprite ceiling everything else on screen is using. The engine caps itself rather than overrunning it (max_effect_particles/max_effect_systems_live, engine/include/gbml/config.h) and an over-budget spawn is quietly dropped - never an error, never a crash, so a too-generous burst thins out instead of breaking. The GBA has no per-sprite alpha, so `fade_out` is faked by flickering a particle off on alternating frames as it dies, not by dissolving it. A rotated or scaled particle wants a hardware affine matrix, of which there are only 32 for the whole screen: past the effect budget the engine falls back to a shared quantized matrix, then to plain flips.